@extends('address.index')
@section('content')

<div style="margin-left:450px;margin-top:50px" class="myaddr_table" id="addressListDiv">
<form action="/address/update" method="post">
	<!--导入插件-->
	<script type="text/javascript" src="/homeHTML/js/addressjquery.js"></script>
    <script type="text/javascript" src="/homeHTML/js/area.js"></script>

    <script type="text/javascript" src="/homeHTML/js/location.js"></script>
    <link rel="stylesheet" href="/homeHTML/css/common.css">
		
			收货人姓名:<input type="text" name="getman" value="{{$address->getman}}"><br>
			收货人手机:<input type="text" name="phone" value="{{$address->phone}}"><br>
			<!--层级联动选择框-->
		详细地址:&nbsp;&nbsp;&nbsp;
		<select id="loc_province" class="" name="sheng" attr="{{$address->sheng}}" style="width:80px;" >
			
		</select>
		<select id="loc_city" class="" name="shi" attr="{{$address->shi}}"  style="width:100px;">
			
		</select>
		<select id="loc_town" class="" name="xian" attr="{{$address->xian}}" style="width:120px;">
			
		</select>
		<br>
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="jiedao" value="{{$address->jiedao}}">(请填写详细地址,确保准确送达)
		<br>是否设为默认
		<label><input type="radio" name="isdefault" value='1' @if($address->isdefault == 1)
									checked
									@endif
		>是</label>
		<label><input type="radio" name="isdefault" value='0' @if($address->isdefault == 0)
									checked
									@endif
		>否</label>
		<input type="hidden" name="id" value="{{$address->id}}">
		{{csrf_field()}}
		<button  class="btn btn-primary">保存</button>
</form>	
</div>

@endsection

@section('ssx')
 <script type="text/javascript">
$(document).ready(function() {
    
    var sheng = $('#loc_province').attr('attr');
    var shi = $('#loc_city').attr('attr');
    var xian = $('#loc_town').attr('attr');
    	// alert(sheng);
    $('#loc_province option[value='+sheng+']').attr('selected','selected');
    $('#loc_province').trigger('change');
    $('#loc_city option[value='+shi+']').attr('selected','selected');
    $('#loc_city').trigger('change');
    $('#loc_town option[value='+xian+']').attr('selected','selected');
	    // console.log($('#loc_province').attr('id'));
	    // $('#loc_province').onchange(function(){
	    // 	alert(1);
	    // })
    
  });
   </script>
@endsection